<style>
#modal-add {
	padding: 20px 25px 25px 0;
}

#modal-add .layui-treeSelect .ztree li a, .ztree li span {
	margin: 0 0 2px 3px !important;
}

.layui-input-block {
	margin-left: 160px;
}

.layui-form-label {
	width: 130px;
}
</style>
<div class="layui-fluid" id="modal-add">
	<form class="layui-form" action="" lay-filter="modal-add-form">
		<div class="layui-form-item">
			<label class="layui-form-label">Work Time：</label>
			<div class="layui-input-block">
				<input type="text" name="workTime" class="layui-input" id="workTime">
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label febs-form-item-require">Category：</label>
			<div class="layui-input-block">
				<input type="text" name="category" autocomplete="off" lay-verify="required" class="layui-input">
				<!-- 				<select name="category" id="category" lay-verify="required"> -->
				<!-- 					<option value="local">local</option> -->
				<!-- 					<option value="ftp">ftp</option> -->
				<!-- 					<option value="sftp">sftp</option> -->
				<!-- 				</select> -->
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">Error Code：</label>
			<div class="layui-input-block">
				<input type="text" name="errorcode" autocomplete="off" lay-verify="required|number"
					class="layui-input">
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">EmailGroup：</label>
			<div class="layui-input-block">
				<select name="emailGroup" id="emailGroup-select" lay-verify="required"
					lay-filter="createOptions3">
				</select>
			</div>
		</div>
		<div class="layui-form-item layui-form-text">
			<label class="layui-form-label">description：</label>
			<div class="layui-input-block">
				<textarea name="description" lay-verify="required" class="layui-textarea"></textarea>
			</div>
		</div>
		<div class="layui-form-item febs-hide">
			<button class="layui-btn" lay-submit="" lay-filter="add-form-submit" id="submit"></button>
			<button type="reset" class="layui-btn" lay-filter="add-form-reset" id="reset"></button>
		</div>
	</form>
</div>

<script>
	layui
			.use(
					[ 'febs' ,'form' ,'validate' ,'laydate' ],
					function(){
						var $ = layui.$ , febs = layui.febs , layer = layui.layer , form = layui.form , $view =
								$('#modal-add') , validate = layui.validate;
						form.verify(validate);
						form.render();
						febs.createOptions('fdiMetadataGroupDefine', $('#emailGroup-select'), {key1:'id', key2:'groupDescription'});
						var laydate = layui.laydate;
						//执行一个laydate实例
						laydate.render({
							elem : '#workTime' ,//指定元素
							range : true ,
							type : 'time' ,
							value : '09:00:00 - 17:00:00'
						});
						form.on('submit(add-form-submit)', function(data){
							//data.field.ID = 0;
							var worktimeEnd , worktimeStart, worktime =
									data.field.workTime;
							if (worktime) {
								worktimeStart = worktime.split('-')[0].trim();
								worktimeEnd = worktime.split('-')[1].trim();
							}
							data.field.emailGroup = document.getElementById("emailGroup-select").value;
							data.field.worktimeStart=worktimeStart;
							data.field.worktimeEnd=worktimeEnd;
							febs.post(ctx + 'fdiErrorcodeConfig', data.field, function(r){
								layer.closeAll();
								febs.alert.success('Data Added!');
								$('#febs-table-container').find('#query').click();
							});
							return false;
						});
						form.on('reset(add-form-reset)', function(){
							form.reset();
						});
					});
</script>